package com.huangj.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.util.Log;

import com.huangj.entity.HomePics;
import com.huangj.fragments.HomePicsFragment;

import java.util.List;

/**
 * Created by HuangJ on 2016/10/3.0:06
 */
public class HomePicsAdapter extends FragmentStatePagerAdapter {

    public List<HomePics> pics;

    public HomePicsAdapter(FragmentManager fm,List<HomePics> pics) {
        super(fm);
        this.pics = pics;
    }

    @Override
    public Fragment getItem(int position) {
        Log.d("print", "getItem: "+pics.get(position).getPhoto_url());
        return HomePicsFragment.getInstans(pics.get(position).getPhoto_url());
    }

    @Override
    public int getCount() {
        return pics.size();
    }
}
